import java.util.Random;

/**
 * @author: knowno
 * @create:
 * @Version 1.0
 * 杨辉三角
 **/
public class TestArray5 {
    public static void main(String[] args) {


        //10*10
        int[][] arr = new int[10][10];

        //使用嵌套循环 + 规律
        for (int i = 0; i < arr.length; i++) {

            //打印空格
            for (int k = 10 - i; k >= 0; k--) {
                System.out.print(" ");
            }

            //注意 j<=i的条件
            for (int j = 0; j <= i; j++) {
                //根据规律拍计算[i][j] =>的值
                if (j == 0 || i == j) {
                    arr[i][j] = 1;
                } else {
                    arr[i][j] = arr[i - 1][j] + arr[i - 1][j - 1];
                }


                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }


    }
}
